package com.iflytek.management.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import com.iflytek.management.pojo.Message;

public interface MessageMapper {
	
	//添加新消息
	@Insert("insert into message (userid, message, time) values (#{userid}, #{message}, #{time})")
    int insert(Message msg)throws Exception;

    //通过id查询消息
    @Select("select * from message where userid=#{userid}")
    List<Message> selectByPrimaryKey(Integer userid)throws Exception;
    
    //通过时间查询消息
    @Select("select * from message where time=#{time}")
    List<Message> selectByTime(Integer time)throws Exception;
    
    // 查询所有消息
    @Select("select * from message")
    List<Message> selectAllMess()throws Exception;
}